keep if sample==1
gen a=date_response
sort a
keep if a<=405

gen n=1
collapse business_w5 comply (sum) n, by(agency_participation* treatment agency_participation_w agency)
br
sort agency 

*Before
qui reg agency_participation_w_b n business_w5 treatment, vce(cluster agency)
	est store Reg1
qui reg agency_participation_w_b comply n business_w5 treatment, vce(cluster agency)
	est store Reg2 

*After
qui reg agency_participation_w_a n business_w5 treatment, vce(cluster agency)
	est store Reg3 
qui reg agency_participation_w_a comply n business_w5 treatment, vce(cluster agency)
	est store Reg4 

*Any time
qui reg agency_participation_w n business_w5 treatment, vce(cluster agency)
	est store Reg5 
qui reg agency_participation_w comply n business_w5 treatment, vce(cluster agency)
	est store Reg6

#delimit ;
global Note_Table_D2 "
{\begin{minipage}{1.19\textwidth}
\small  
\vspace{0.2cm} 
\textit{Notes:} * p $math < $math 0.10, ** p $math < $math 0.05, *** p $math < $math 0.01. Standard errors clustered at the agency level are shown in parentheses. The analysis only considers requests that were already closed before August 22, 2018. One agency is not included because the two requests it received closed after August 22, 2019. The dependent variable in Columns 1 and 2 indicates the agency's attendance at one or both of the workshops offered by DGSOCAI on August 22 and September 4, 2018.  Columns 3 and 4 consider the participation of the agency after the treatment started on September 6. Finally, the dependent variable in columns 5 and 6 is the agency's participation in a workshop at any stage. 
 \end{minipage}
 }
";
#delimit cr

esttab Reg1 Reg2 Reg3 Reg4 Reg5 Reg6 using "$Tables/Table_D2.tex", replace  label  b(%5.3f) se(%5.3f) star(* 0.10 ** 0.05 *** 0.01) mlabels("Participation_W_b" "Participation_W_b" "Participation_W_a" "Participation_W_a" "Participation_W" "Participation_W") refcat(treatment   "\vspace{-6mm}", nolabel) stats(N r2,  labels(`"Observations"' `"R-squared"', prefix(\addlinespace[3pt])) fmt( %10.0fc %10.3fc 0 0) ) order(treatment business_w5 n) coeflabels($labels)  addnote($Note_Table_D2)   nonumber nonote compress noomitted nobaselevels 
